package com.yifeng.repo.controller.fadada.constant;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by daibing on 2024/11/23.
 */
@Getter
@AllArgsConstructor
public enum AccountTypeEnum {
    PERSON("1","个人"),
    COMPANY("2","企业");

    @EnumValue
    @JsonValue
    private final String code;

    private final String name;

    private static final Map<String, AccountTypeEnum> mappings = new HashMap<>(2);

    static {
        for (AccountTypeEnum value : values()) {
            mappings.put(value.getCode(), value);
        }
    }

    public static AccountTypeEnum resolve(String code) {
        return (code != null ? mappings.get(code) : null);
    }
}
